package exception;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

/*
异常处理机制在IO操作中的运用
 */
public class TryFinallyDemo2 {
    public static void main(String[] args) {
        FileOutputStream fos=null;
        try{
            fos=new FileOutputStream("./adf/fsd/fox.txt");
            fos.write(1);
        }catch (IOException e){
            System.out.println("exception");
        }finally {

            try {
                fos.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        System.out.println("finished");
    }
}
